<template>
	<view class="">
	</view>
</template>

<script>
	export default {
		data() {
			return {
				option: {},
			}
		},
		onLoad(option) {
			this.option = option;
		},
		methods: {
			init() {
				const _this = this;
				uni.chooseLocation({
					success: function(res) {
						let val = JSON.stringify(res);
						let obj = {
							ids: _this.option.ids ? Number(_this.option.ids) : '',
							data: {
								latitude: val.latitude,
								longitude: val.longitude,
								name: val.name,
							}
						}
						_this.$store.commit("repeatAdd/pushData", obj)
						_this.$store.commit("repeatAdd/getPushItem", obj)
						uni.redirectTo({
							url: `./index`
						})
					},
					fail() {
						uni.redirectTo({
							url: `./index`
						})
					}
				});

			}

		},
		onLoad() {
			this.init()
		},
		created() {
		}
	}
</script>

<style scoped lang="scss">
	/deep/ .uni-searchbar {
		background-color: #F1F1F1 !important;
	}

	/deep/ .uni-searchbar__box {
		justify-content: flex-start !important;
	}
</style>
